﻿using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace DcscDS.IdGenerator.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class HomeController : ControllerBase
    {
        private readonly IDcscIdGenerator _dcscIdGenerator;
        public HomeController(
            IDcscIdGenerator dcscIdGenerator
            )
        {
            _dcscIdGenerator = dcscIdGenerator;
        }
        /// <summary>
        /// 获取分布式ID
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetIds()
        {
            return Ok(_dcscIdGenerator.NextId());
        } 
    }
}
